<?php
/*
 * 受访分析相关
 * copyright:living10
 */
 class RespAnalysis extends CI_Controller{
	public function __construct(){
		parent::__construct();
		$this->load->model('RespAnalysis_model');
		$this->load->helper('date');
		$this->load->helper('url');
	}

	//查询受访页面
	public function showbyRespPage()
	{

		$header['title'] = '受访分析';
		$header['location1'] = '受访页面';
		$header['location2'] = '受访页面';
		$tmp_sdate = $this->input->post("search_sdate");
		if($tmp_sdate)
		{
			$search_sdate = $tmp_sdate;
			$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
			$search_day = -1;
		}else{
			$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
			$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
			$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		}
		$data = $this->RespAnalysis_model->showRespPage($search_sdate,$search_edate);
		$data['search_day'] = $search_day;
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
 		$this->load->view('main/header',$header);
 		$this->load->view('main/Resp_Analysis/showRespPage',$data);
 		$this->load->view('main/footer');
	}

	//来路域名
	public function showbyinner()
	{
		$header['title'] = '站内入口';
		$header['location1'] = '受访分析';
		$header['location2'] = '站内入口';
		$tmp_sdate = $this->input->post("search_sdate");
		if($tmp_sdate)
		{
			$search_sdate = $tmp_sdate;
			$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
			$search_day = -1;
		}else{
			$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
			$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
			if($search_day == 1)
			{
				$search_edate = $search_sdate;
			}else{
				$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
			}
		}
		$data = $this->RespAnalysis_model->showInner($search_sdate,$search_edate);
		$data['search_day'] = $search_day;
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
 		$this->load->view('main/header',$header);
 		$this->load->view('main/Resp_Analysis/showinner',$data);
 		$this->load->view('main/footer');
	}
	/*初访页面*/
	public function showbyfirst()
	{
		$header['title'] = '初访页面';
		$header['location1'] = '受访分析';
		$header['location2'] = '初访页面';
		$tmp_sdate = $this->input->post("search_sdate");
		if($tmp_sdate)
		{
			$search_sdate = $tmp_sdate;
			$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
			$search_day = -1;
		}else{
			$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
			$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
			$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		}
		$data = $this->RespAnalysis_model->showRespPage($search_sdate,$search_edate);
		$data['search_day'] = $search_day;
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
 		$this->load->view('main/header',$header);
 		$this->load->view('main/Resp_Analysis/showfirst',$data);
 		$this->load->view('main/footer');
	}
 }
?>
